<template>
  <div>
    <van-form @submit="onSubmit">
      <van-field
        v-model="username"
        name="手机号"
        label="手机号"
        placeholder="手机号"
        :rules="ruleObj.ruleArr"
      />
      <van-field
        v-model="password"
        type="password"
        name="密码"
        label="密码"
        placeholder="密码"
        :rules="[{ required: true, message: '请填写密码' }]"
      />
    </van-form>
    <van-field
      v-model="sms"
      center
      clearable
      label="短信验证码"
      placeholder="请输入超超姓名"
    >
      <template #button>
        <van-button size="small" type="primary" :style="{ color: 'red' }"
          >发射</van-button
        >
      </template>
      <template #left-icon>
        <van-icon name="chat-o" />
      </template>
    </van-field>
    <div style="margin: 16px">
      <van-button round block type="info" native-type="submit">提交</van-button>
    
    </div>
    
  </div>
</template>
<script>
const validator = (value, rule) => {
  let reg = /^1[3456789]\d{9}$/
  let flag = reg.test()
  return flag
}
export default {
  name: '',
  data () {
    return {
      username: '',
      password: '',
      ruleObj: {
        ruleArr: [{ required: true, message: '请填写手机号' },
        { validator, message: '请输入正确的手机号' },
        ]
      },

    }
  },
  created () {
  },
  computed: {
  },
  methods: {
  }
}
</script>
<style lang='less'  scoped>
.bb {
  background-color: yellow;
}
</style>
